const express = require('express');
const app = express();
app.listen(3000,()=>{console.log('服务器已开启')});
const path = require('path');
const formidable = require('formidable');

app.post('/upload',(req,res)=>{
    let form = formidable({
        uploadDir: path.join(__dirname,'upload'),
        keepExtensions:true 
    })
    form.parse(req,(err,fileds,files)=>{
        console.log(err,fileds,files); 
        if(err){
            res.send(err)
        }else{
            res.send('上传成功')
        }
    })
})